# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Jens Pranaitis <jens@jenux.homelinux.org>

pkgname=nix-busybox
_pkgname="${pkgname#nix-}"
pkgver=1.35.0
pkgrel=1
pkgdesc='Slimmed down busybox for Nix sandbox builds'
arch=('loong64' 'x86_64')
url='https://www.busybox.net'
license=('GPL')
makedepends=(
  'ncurses'
  'musl'
  'kernel-headers-musl'
)
source=(
  "$url/download/$_pkgname-$pkgver.tar.bz2"{,.sig}
  'config'
)
b2sums=('c08656bc863cd3fa8f7269032e808a30832215c36414c12f8233ab00503636ed1979541b7df42df654f1dfdfdd46fc00c8fe790bf0bed629a915b4c806c643b9'
        'SKIP'
        'd592c063dc3f19c00795ba1dfd5241dad365b08a30494126fb3a5ef3c6d9077d885c0a2e150e7b5d9f06f483adcdeeea8df660be208373318472af9fcc52c5c7')
validpgpkeys=('C9E9416F76E610DBD09D040F47B70C55ACC9965B') # Denis Vlasenko <vda.linux@googlemail.com>

build() {
  cd "$_pkgname-$pkgver"

  cp "$srcdir/config" .config

  # reproducible build
  export KCONFIG_NOTIMESTAMP=1
  make CC=musl-gcc
}

package() {
  cd "$_pkgname-$pkgver"

  install -vDm755 -t "$pkgdir/usr/lib/nix" busybox
}
